#!/bin/bash
###SHELLPACK preamble salmon 1.2.1
WEB_LOCATION="http://salmon-tddft.jp/download"
MIRROR_LOCATION="$WEBROOT/salmon"

###SHELLPACK mpi_setup_deps SALMON_OPENMPI_VERSION
###SHELLPACK mpi_setup_env SALMON_OPENMPI_VERSION SALMON_MPI_PATH SALMON_MPI_LIBPATH

if [ "$SALMON_PROCESSES" != "1" ]; then
	MPI_SWITCH="--enable-mpi"
else
	MPI_SWITCH="--disable-mpi"
fi
install-depends gcc-fortran cmake python

###SHELLPACK parseargBegin
###SHELLPACK parseargEnd

###SHELLPACK sources_fetch SALMON-v.${VERSION}.tar.gz salmon-${VERSION}
###SHELLPACK build_start salmon-${VERSION}

SALMONDEPS_ROOT="$SHELLPACK_SOURCES/salmondeps-installed"
INCLUDES="-I$SALMONDEPS_ROOT/include"
LIBS=" -L$SALMONDEPS_ROOT/$MMTESTS_LIBDIR"
LD_LIBS="$SALMONDEPS_ROOT/$MMTESTS_LIBDIR"

export CFLAGS+=" $INCLUDES $LIBS"
export CXXFLAGS+=" $INCLUDES $LIBS"
export FFLAGS+=" $INCLUDES $LIBS -lgomp"
export LD_LIBRARY_PATH="$LD_LIBS:$LD_LIBRARY_PATH"

###SHELLPACK build_configure_py salmon-${VERSION} $MPI_SWITCH --compiler-vec --enable-scalapack --enable-libxc --verbose
###SHELLPACK make_make_install

echo salmon installed successfully
exit $SHELLPACK_SUCCESS
